package com.example.administrator.managesystem.activity.login;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.support.annotation.Nullable;
import android.util.Log;

import com.example.administrator.managesystem.R;
import com.example.administrator.managesystem.activity.VideoListActivity;
import com.example.administrator.managesystem.base.BaseActivity;
import com.example.administrator.managesystem.utils.ShareUtil;
import com.example.administrator.managesystem.video.LandListActivity;

public class LogoActivity extends BaseActivity {
    private CountDownTimer countDownTimer;
    @Override
    public void initView() {

        showfloatButton(false,false);
//        if(!ShareUtil.getTag(this)){//默认是false
//            gotoActivity(LeadActivity.class,true);

//        }



    }
    @Override
    protected void onStart() {
        // TODO Auto-generated method stub
        super.onStart();
        Log.e("msg","onStart");
    }

    @Override
    protected void onRestart() {
        // TODO Auto-generated method stub
        super.onRestart();
        Log.e("msg"," onRestart");
    }

    @Override
    protected void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
        Log.e("msg","onResume");
    }

    @Override
    public void doBusiness() {

             countDownTimer= new CountDownTimer(2000,1000) {
            @Override
            public void onTick(long millisUntilFinished) {


            }

            @Override
            public void onFinish() {
                Log.e("msg","isLogin():"+isLogin());
                if(isLogin()){
                    gotoActivity(LandListActivity.class,true);
                }else{
                    gotoActivity(LoginActivity.class,true);
                }
                //  gotoActivity(LoginActivity.class,true);
            }
        };

        countDownTimer.start();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (countDownTimer != null) {
            countDownTimer.cancel();
        }
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_logo;
    }

    public boolean isLogin() {
        Log.e("msg","ShareUtil.getUserId(this):"+ShareUtil.getUserId(this));
        if (ShareUtil.getUserId(this)==null || ShareUtil.getUserId(this).equalsIgnoreCase("") ) {
            return false;
        } else return true;
    }
}
